using System.Collections.Generic;
using System.Diagnostics;
using Microsoft.MediaCenter;
using Microsoft.MediaCenter.Hosting;
using Microsoft.MediaCenter.UI;

namespace MyMV
{
    public class Application : ModelItem
    {
        private static Application singleApplicationInstance;
        private AddInHost host;
        private HistoryOrientedPageSession session;

        public Application()
            : this(null, null)
        {
        }

        public Application(HistoryOrientedPageSession session, AddInHost host)
        {
           
            this.session = session;
            this.host = host;
            singleApplicationInstance = this;
        }

        public MediaCenterEnvironment MediaCenterEnvironment
        {
            get
            {
                if (host == null) return null;
                return host.MediaCenterEnvironment;
            }
        }

        public void GoToMenu()
        {
            Dictionary<string, object> properties = new Dictionary<string, object>();
            properties["Application"] = this;

            if (session != null)
            {
                session.GoToPage("resx://MyMV/MyMV.Resources/Default", properties);
            }
            else
            {
                Debug.WriteLine("GoToMenu");
            }
        }
        public void GoToAbout()
        {
            Dictionary<string, object> properties = new Dictionary<string, object>();
            properties["Application"] = this;

            if (session != null)
            {
                session.GoToPage("resx://MyMV/MyMV.Resources/Default", properties);
            }
            else
            {
                Debug.WriteLine("GoToMenu");
            }
        }
        public void GoToSettings()
        {
            Dictionary<string, object> properties = new Dictionary<string, object>();
            properties["Application"] = this;

            if (session != null)
            {
                session.GoToPage("resx://MyMV/MyMV.Resources/Test", properties);
            }
            else
            {
                Debug.WriteLine("GoToMenu");
            }
        }
 
        public static Application Current
        {
            get
            {
                return singleApplicationInstance;
            }
        }

  


         

    }
   
}